
var ____temp = Class( {
	Implements :Events,
	__locationInterval :0,
	oldLocation :'',
	initialize : function() {
		var m = this;
		this.__locationInterval = setInterval(function() {
			m.__check();
		}, 100);
	},
	__check : function() {
		if (this.oldLocation != document.location) {
			document.fireEvent('locationChange');
		}
	},
	getAnchor : function(url) {
		if (!url)
			url = document.location;
		var res = '';
		var url = new String(url);
		res = url.split('#', 2);
		if (!res[1]) return null;
		return '' + res[1];
	},
	getLink:function(url) {
		if (!url)
			url = document.location;
		url = String(url);
		var anchor = this.getAnchor(url);
		if (!anchor) return false;
		var link = new Xendri.link(anchor);
		return link;
	}, 
	setAnchor: function(url) {
		document.location = '#'+url;
	}, 
	goto: function(app, state, target) {
		if (!target) target = 'data';
		if (!state) state = 'main';
		if (!app) throw ('Application is must be defined for location::goto!');
		
		var a = this.getAnchor();
		var l = '/';
		Bro.log('location.goto a:'+a);
		if (a == null) {
			a = '';
		 	l = '';
		}
		
		this.setAnchor(a+l+app+'.'+state+'@'+target);
	}, 
	getDiff: function (url1, url2) {
		var l1 = new Xendri.link(url1);
		var l2 = new Xendri.link(url2);
		l1.expell(l2);
		
		return l1;
	}
});

Xendri.Location = new ____temp();